home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DATETIME.SWG / 0033_Day of the Week.pas < prev    next >
Pascal/Delphi Source File  |  1994-01-27  |  1KB  |  32 lines

  1.  
  2. > I am currently trying to create a calendar that will ask the
  3. > user to input a year and month.  The program should print out that
  4. > particular month.  I believe I have a design I would like to follow,
  5. > but I cant figure out the formula to figure out the first day of the
  6. > month for any year between 1900-2000.
  7.  
  8. I have something more general from my class. Here it is:
  9.  
  10.   A. Take the last two digits of the year
  11.   B. Add a quarter of this number (neglect the remainder)
  12.   C. Add the day of the month
  13.   D. Add according to the month:
  14.      Jan 1    Feb 4    March 4    April 0    May 2    June 5
  15.      July 0   Aug 3    Sept  6    Oct   1    Nov 4    Dec  6
  16.   E. Add for century
  17.        18th 4                   20th 0
  18.        19th 2                   21st 6
  19.   F. Divide total by 7
  20.   G. The remainder gives day of week:
  21.      Sunday       1
  22.      Monday       2
  23.      Tuesday      3
  24.      Wednesday    4
  25.      Thursday     5
  26.      Friday       6
  27.      Saturday     0
  28.  
  29. This should work for any day between the years 1700-2099. Maybe you
  30. could figure out the exact formula you needed from this.
  31.  
  32.